<style type="text/css">
.normal_form[form-role="dialog"] {padding-top:30px;}
.normal_form[form-role="dialog"] .input-text{width:250px;}
</style>
<form name="dialogform" class="normal_form" form-role="dialog" onsubmit="return Core.Sys.Dialogform(this);" autocomplete="off">
    <div class="row">
        <div class="field_text">角色：</div>
        <!--{if !($res['isadmin'] ?? 0)}-->
        <select class="z-select groupid-select" name="groupid" data-style="width:250px;">
            <option value="">请选择角色</option>
            <!--{if isset($group) AND $group}-->
            {foreach $group as $key => $row}
            <option value="{$row['id'] ?? ''}" {if $row['id']==($res['groupid'] ?? 0)}selected{/if}>{$row['title'] ?? ''}</option>
            {/foreach}
            <!--{/if}-->
        </select>
        <!--{else}-->
        <input type="text" class="input-text" value="单位管理员" disabled style="width:250px;" />
        <!--{/if}-->
    </div>
    <div class="row">
        <div class="field_text">手机号：</div>
        <input type="text" class="input-text" name="mobile" value="{$res['mobile'] ?? ''}" disabled style="width:250px;" />
    </div>
    <div style="color:gray;text-indent:105px;line-height:25px;"></div>
    <div class="row">
        <div class="field_text">姓名：</div>
        <input type="text" class="input-text" name="realname" value="{$res['realname'] ?? ''}" disabled style="width:250px;" />
    </div>
    <div class="row">
        <div class="field_text">性别：</div>
        <div class="labelrow" >
            <label class="l-radio"><input type="radio" name="gender" value="1" disabled {if ($res['gender'] ?? 1)==1}checked{/if} /><i></i><span>男</span></label>
            <label class="l-radio"><input type="radio" name="gender" value="2" disabled {if ($res['gender'] ?? 0)==2}checked{/if} /><i></i><span>女</span></label>
        </div>
    </div>
    <div class="row form-footer-bar">
        <p class="colortip"></p>
        <button class="btn" role="btn-cancel">取消</button>
        <button class="btn btn-primary" type="submit" role="btn-submit">保存</button>
    </div>
</form>
<!--{if !($res['isadmin'] ?? 0)}-->
<script type="text/javascript">
Core.Sys.Dialogform = function(form){
    var form = $(form);
    var p    = {
        'groupid'  : $(".groupid-select").getZsValue(),
	}

    if (!Core.rule('intp',p['groupid'])){
		form.find("p.colortip").html('请选择角色!');return false;
	}

	form.find(":button").attr('disabled','disabled');
	$.ajax({type : "POST",dataType: "json",cache : false, url : "{$_G['_mca_']}/suid/{$res['suid'] ?? 0}?r="+Math.random(),data : p,success: function(data){
	   try{
		   if (data['state'] == 'y'){
                $('#datalist').datagrid('reload');$(form).dialogClose();
		   } else {
                form.find(":button").removeAttr('disabled');form.find("p.colortip").html(data['msg']);return false;
		   }
	   }catch(e){form.find(":button").removeAttr('disabled');form.find("p.colortip").html('数据提交失败!');return false;}
	}});
	return false;
}
$(function(){});
</script>
<!--{else}-->
<script type="text/javascript">
Core.Sys.Dialogform = function(form){
    $(form).dialogClose();
}
</script>
<!--{/if}-->